package com.ls.smartcampus2.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ls.smartcampus2.pojo.TreeHole;
import com.ls.smartcampus2.pojo.TreeHoleResult;
import com.ls.smartcampus2.service.TreeHoleResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dell
 */
@RestController
public class TreeHoleResultController {
    @Autowired
    private TreeHoleResultService treeHoleResultService;
    @GetMapping("/getTreeHoleMsg")
    public String getTreeHoleMsg(String sid) throws JsonProcessingException {
//        sid="1743205000113";
        ObjectMapper mapper=new ObjectMapper();
        List<TreeHoleResult> treeHoleMsg = treeHoleResultService.getTreeHoleMsg(sid);
        String s = mapper.writeValueAsString(treeHoleMsg);
        return s;


    }
}
